import http from "@/utils/request"
import qs from 'qs';
/*
 ** 前端封装API接口模块 ：用户(User) 模块
 */

// 用户登录
export function loginAPI(params) {
	return http.request({
		url: "v2/DwUser/login",
		method: "post",
		data: params,
	});

}
//用户退出登录
export function logoutAPI() {
	return http.request({
		url: "v2/DwUser/logout",
		method: "get",
	})
}

// 用户注册
export function registerAPI(params) {
	return http.request({
		headers: {
			'content-type': 'application/x-www-form-urlencoded'
		},
		data: qs.stringify(params),
		url: "/v2/DwUser/register",
		method: "post",

	});
}

// 根据用户Id获取用户信息详情
export function getDetailByIdAPI(id) {
	return http.request({
		url: "/v2/DwUser/getDwUserList",
		method: "get",
		params: {
			id
		},
	});
}
// 根据用户Id修改用户信息
export function updateAPI(params) {
	return http.request({
		url: "/v2/DwUser/updata",
		method: "post",
		data: params,
	});
}
// 上传用户头像
export function uploadAvatarAPI(formData) { 
  return http.post("v2/DwUser/upFile", formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    },
  });
}  